﻿/*********************RibbonModel.ToChuc.cs****************************\
 * Module Name: Ribbon Model for tab To Chuc
 * Author: cyworld8x
\***********************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OODCRM.Common;
using Microsoft.Windows.Controls.Ribbon;

namespace OODCRM.ViewModel
{
    public static partial class RibbonModel
    {
        #region ViewModel

        public static GroupData LienHe_Group
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "LienHe_Group";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        GroupData groupData = new GroupData("Liên hệ")
                        {
                            IsEnabled = true,
                            LargeImage = new Uri("/OODCRM;component/Images/contact32.png", UriKind.Relative)
                        };
                        _dataCollection[Str] = groupData;
                    }

                    return _dataCollection[Str] as GroupData;
                }
            }
        }

        public static ControlData LienHe_New
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "Thêm liên hệ";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        string ToolTipTitle = "Thêm mới 1 liên hệ (Ctr+N)";
                        string ToolTipDescription = "Tạo mới 1 liên hệ và nhập thông tin về đối tượng liên hệ";

                        ButtonData buttonData = new ButtonData()
                        {
                            Label = Str,
                            SmallImage = new Uri("/OODCRM;component/Images/add1-16.png", UriKind.Relative),
                            ToolTipTitle = ToolTipTitle,
                            ToolTipDescription = ToolTipDescription,
                            Command = new DelegateCommand(LienHe_NewExecuted, DefaultCanExecute),
                            KeyTip = "N",
                        };
                        _dataCollection[Str] = buttonData;
                    }

                    return _dataCollection[Str];
                }
            }
        }


        public static ControlData LienHe_Edit
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "Sửa liên hệ";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        string ToolTipTitle = "Sửa 1 liên hệ (Ctr+N)";
                        string ToolTipDescription = "Sửa thông tin liên hệ hiện tại";

                        ButtonData buttonData = new ButtonData()
                        {
                            Label = Str,
                            SmallImage = new Uri("/OODCRM;component/Images/edit16.png", UriKind.Relative),
                            ToolTipTitle = ToolTipTitle,
                            ToolTipDescription = ToolTipDescription,
                            Command = new DelegateCommand(LienHe_EditExecuted, DefaultCanExecute),
                            KeyTip = "E",
                        };
                        _dataCollection[Str] = buttonData;
                    }

                    return _dataCollection[Str];
                }
            }
        }

        public static ControlData LienHe_Delete
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "Xóa liên hệ";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        string ToolTipTitle = "Xóa 1 liên hệ (Ctr+N)";
                        string ToolTipDescription = "Xóa thông tin liên hệ hiện tại";

                        ButtonData buttonData = new ButtonData()
                        {
                            Label = Str,
                            SmallImage = new Uri("/OODCRM;component/Images/delete16.png", UriKind.Relative),
                            ToolTipTitle = ToolTipTitle,
                            ToolTipDescription = ToolTipDescription,
                            Command = new DelegateCommand(LienHe_EditExecuted, DefaultCanExecute),
                            KeyTip = "D",
                        };
                        _dataCollection[Str] = buttonData;
                    }

                    return _dataCollection[Str];
                }
            }
        }


        #endregion ViewModel


        #region Handlers


        internal static void LienHe_NewExecuted()
        {
            MainWindow crmWindow = CRMWindow;
            if (crmWindow != null)
            {
                crmWindow.LienHe_NewExecuted();
            }
        }
        internal static void LienHe_EditExecuted()
        {
            MainWindow crmWindow = CRMWindow;
            if (crmWindow != null)
            {
                crmWindow.LienHe_EditExecuted();
            }
        }
        internal static void LienHe_DeleteExecuted()
        {
            MainWindow crmWindow = CRMWindow;
            if (crmWindow != null)
            {
                crmWindow.LienHe_DeleteExecuted();
            }
        }


        #endregion Handlers
    }

}
